#include "imagezoomer.h"
#include "ui_imagezoomer.h"
#include <iostream>
#include <stdlib.h>
#include <QtGui/QImage>
#include <qdebug.h>

ImageZoomer::ImageZoomer(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ImageZoomer)
{
    ui->setupUi(this);
}

ImageZoomer::~ImageZoomer()
{
    delete ui;
}

void ImageZoomer::updateScale(int d)
{
    scale = (double)d/10.0;
    scaleImage();
}

void ImageZoomer::loadNewImage(QString fileName)
{
    QImage image(fileName);
    if(!image.isNull())
    {
        qDebug()<<"Wczytano";
         ui->imageLabel->setPixmap(QPixmap::fromImage(image));
    }
}


void ImageZoomer::scaleImage()
{
    ui->imageLabel->resize(scale * ui->imageLabel->pixmap()->size());
}
